Component({
    data:{
        select:0,
        rotated:false,
        imgStyle:'',
        list: [
            {
              pagePath: "/pages/index/index",
              text: "首页",
              iconPath: "../images/icons/home .png",
              selectedIconPath: "../images/icons/home-active.png",
              type:0
            },
            {
            type:1
            },
            {
              pagePath: "/pages/user-center/index",
              text: "我的",
              iconPath: "/images/icons/usercenter.png",
              selectedIconPath: "/images/icons/usercenter-active.png",
              type:0
            }
          ],
        icons:[
            {
                imgs:'../images/动态.png',
                text:'动态圈',
                path:'/pages/dynamic/index'
            },
            {
                imgs:'../images/拍照.png',
                text:'卡路里识别',
                path:'/pages/calidentify/index'
            },
            {
                imgs:'../images/计划.png',
                text:'每日计划',
                path:'/pages/dailyplan/index'
            },
            {
                imgs:'../images/发表.png',
                text:'动态发表',
                path:'/pages/dynrelese/index'
            }
        ]
    },
    methods:{
        selectPage(e){
            const { index,page,type}=e.currentTarget.dataset;
            if(index!==this.data.select&&type===0){
               wx.switchTab({
                 url: page,
               })
            }

        },
        rotateImage(){
        //获取当前选择角度
          let rotated=this.data.rotated;
          let rotate=rotated?'rotate(0deg)':'rotate(220deg)';
         //更新状态
         this.setData({
             rotated:!rotated,
             imgStyle:`transform:${rotate};transition:transform 2s`
         })
        },
        goPath(e){
            const {index,path}=e.currentTarget.dataset
            if(index===0){
                wx.switchTab({
                  url: path,
                })
            }else{
                wx.navigateTo({
                  url: path,
                })
            }

            console.log(e)
        }
    }
})